func TestHomepageHandler(t *testing.T) {
mockResponse := `{"message":"Hi, Iron Man"}`
r := SetUpRouter()
r.GET("/home", controller.HomepageHandler)
req, _ := http.NewRequest("GET", "/home", nil)
w := httptest.NewRecorder()
r.ServeHTTP(w, req)
responseData, _ := ioutil.ReadAll(w.Body)
assert.Equal(t, mockResponse, string(responseData))
assert.Equal(t, http.StatusOK, w.Code)
}
更精確的說 ,Fuzzing Test 是把重點放在程式所跑出來的行為上,讓你減少去想測試資料的問題